import request from './request'

const api = {
  // 登录
  login: (params) => request.post('/login', params),

  // 注册
  register: (params) => request.post('/register', params),

  // 发送邮箱验证码
  sendEmailCode: (params) =>
    request.post('/user/forgetPassword/sendCode', params),

  // 验证邮箱验证码
  verifyEmailCode: (params) =>
    request.post('/user/forgetPassword/verifyCode', params),

  // 重置密码
  resetPassword: (params) => request.post('/user/forgetPassword/reset', params),

  // 新增邀请码
  addInviteCode: (params) => request.post('/appinvite/create', params),

  // 获取邀请码记录
  getInviteCodeList: (params) => request.post('/appinvite/record', params),

  // 全局搜索
  search: (params) => request.post('/search', params),

  // 搜索用户
  searchUser: (params) => request.post('/searchUser', params),

  // 添加用户为好友
  sendAddUserMsg: (params) => request.post('/SendAddUserMsg', params),

  // 获取用户信息
  getUserInfo: (params) => request.post('/user/getInfo', params),

  // 获取用户积分余额
  getTotalScore: (params) =>
    request.get('/user_account_points/balance', params),

  // 获取用户积分列表
  getUserScoreList: (params) =>
    request.post('/user_account_points/history', params),

  // ---- 群组相关 ----

  // 创建群组
  addGroup: (params) => request.post('/group/create', params),

  // 退出群聊
  quitGroup: (params) => request.post('/group/member/quit', params),

  // 转让群主
  exchangeQunzhu: (params) => request.post('/group/transfer', params),

  // 添加群组成员
  addGroupMember: (params) => request.post('/group/member/add', params),

  // 移除群组成员
  removeGroupMember: (params) => request.post('/group/member/remove', params),

  // ---- 收藏相关 ----

  // 收藏
  collect: (params) => request.post('/favorites/add', params),

  // 取消收藏
  deleteCollect: (params) => request.delete(`/favorites/${params.id}`),

  // 获取收藏列表
  getCollectList: (params) => request.get('/favorites/list', params),
}

export default api
